typedef struct {
guint refcount;
- /* Last time the user interacted with any of this application's windows */
- guint32 last_user_time;
-
/* Signal connection to dirty window sort list on workspace changes */
guint workspace_switch_id;
window = most_recent_transient;
- if (!shell_window_tracker_is_window_interesting (window))
- {
- /* We won't get notify::user-time signals for uninteresting windows,
- * which means that an app's last_user_time won't get updated.
- * Update it here instead.
- */
- app->running_state->last_user_time = timestamp;
- }
-
if (active != workspace)
meta_workspace_activate_with_focus (workspace, window, timestamp);
else
return FALSE;
}
+static int
+shell_app_get_last_user_time (ShellApp *app)
+{
+ GSList *iter;
+ int last_user_time;
+
+ last_user_time = 0;
+
+ if (app->running_state != NULL)
+ {
+ for (iter = app->running_state->windows; iter; iter = iter->next)
+ last_user_time = MAX (last_user_time, meta_window_get_user_time (iter->data));
+ }
+
+ return last_user_time;
+}
+
/**
* shell_app_compare:
* @app:
return -1;
else if (!app->running_state->windows && other->running_state->windows)
return 1;
- return other->running_state->last_user_time - app->running_state->last_user_time;
+
+ return shell_app_get_last_user_time (other) - shell_app_get_last_user_time (app);
}
return 0;
{
g_assert (app->running_state != NULL);
- app->running_state->last_user_time = meta_window_get_user_time (window);
-
/* Ideally we don't want to emit windows-changed if the sort order
* isn't actually changing. This check catches most of those.
*/
_shell_app_add_window (ShellApp *app,
MetaWindow *window)
{
- guint32 user_time;
-
if (app->running_state && g_slist_find (app->running_state->windows, window))
return;
g_signal_connect (window, "unmanaged", G_CALLBACK(shell_app_on_unmanaged), app);
g_signal_connect (window, "notify::user-time", G_CALLBACK(shell_app_on_user_time_changed), app);
- user_time = meta_window_get_user_time (window);
- if (user_time > app->running_state->last_user_time)
- app->running_state->last_user_time = user_time;
-
if (app->state != SHELL_APP_STATE_STARTING)
shell_app_state_transition (app, SHELL_APP_STATE_RUNNING);